package com.ruoyi.system.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.FkwzUserQuestionAnswer;
import com.ruoyi.system.service.IFkwzUserQuestionAnswerService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 检查问卷用户检查详情Controller
 * 
 * @author ruoyi
 * @date 2024-06-11
 */
@RestController
@RequestMapping("/answer")
public class FkwzUserQuestionAnswerController extends BaseController
{
    @Autowired
    private IFkwzUserQuestionAnswerService fkwzUserQuestionAnswerService;

    /**
     * 查询检查问卷用户检查详情列表
     */
    @RequiresPermissions("system:answer:list")
    @GetMapping("/list")
    public TableDataInfo list(FkwzUserQuestionAnswer fkwzUserQuestionAnswer)
    {
        startPage();
        List<FkwzUserQuestionAnswer> list = fkwzUserQuestionAnswerService.selectFkwzUserQuestionAnswerList(fkwzUserQuestionAnswer);
        return getDataTable(list);
    }

    /**
     * 导出检查问卷用户检查详情列表
     */
    @RequiresPermissions("system:answer:export")
    @Log(title = "检查问卷用户检查详情", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FkwzUserQuestionAnswer fkwzUserQuestionAnswer)
    {
        List<FkwzUserQuestionAnswer> list = fkwzUserQuestionAnswerService.selectFkwzUserQuestionAnswerList(fkwzUserQuestionAnswer);
        ExcelUtil<FkwzUserQuestionAnswer> util = new ExcelUtil<FkwzUserQuestionAnswer>(FkwzUserQuestionAnswer.class);
        util.exportExcel(response, list, "检查问卷用户检查详情数据");
    }

    /**
     * 获取检查问卷用户检查详情详细信息
     */
    @RequiresPermissions("system:answer:query")
    @GetMapping(value = "/{answerId}")
    public AjaxResult getInfo(@PathVariable("answerId") Long answerId)
    {
        return AjaxResult.success(fkwzUserQuestionAnswerService.selectFkwzUserQuestionAnswerByAnswerId(answerId));
    }

    /**
     * 新增检查问卷用户检查详情
     */
    @RequiresPermissions("system:answer:add")
    @Log(title = "检查问卷用户检查详情", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FkwzUserQuestionAnswer fkwzUserQuestionAnswer)
    {
        return toAjax(fkwzUserQuestionAnswerService.insertFkwzUserQuestionAnswer(fkwzUserQuestionAnswer));
    }

    /**
     * 修改检查问卷用户检查详情
     */
    @RequiresPermissions("system:answer:edit")
    @Log(title = "检查问卷用户检查详情", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody FkwzUserQuestionAnswer fkwzUserQuestionAnswer)
    {
        return toAjax(fkwzUserQuestionAnswerService.updateFkwzUserQuestionAnswer(fkwzUserQuestionAnswer));
    }

    /**
     * 删除检查问卷用户检查详情
     */
    @RequiresPermissions("system:answer:remove")
    @Log(title = "检查问卷用户检查详情", businessType = BusinessType.DELETE)
	@PostMapping("/{answerIds}")
    public AjaxResult remove(@PathVariable Long[] answerIds)
    {
        return toAjax(fkwzUserQuestionAnswerService.deleteFkwzUserQuestionAnswerByAnswerIds(answerIds));
    }
}
